package Test;
import org.junit.Test;

import App.Gamme;
import App.Modele;
import App.Option;


public class ModeleTest {

	Modele m = new Modele("Renault", "Laguna");

	@Test
	public void testModele() {
		assert m.getMarque().equals("Renault");
		assert m.getNom().equals("Laguna");
	}

	@Test
	public void testAddGamme() {
		Gamme g1 = new Gamme("Sport");
		g1.addOption(new Option("Aileron"));
		g1.addOption(new Option("Autoradio"));
		g1.addOption(new Option("Jantes alu"));
		m.addGamme(g1);
		Gamme g2 = new Gamme("Promo");
		g2.addOption(new Option("Autoradio"));
		m.addGamme(g2);
		assert (m.getGammes().size() == 2);
		assert m.getGammes().contains(g1);
		assert m.getGammes().contains(g2);
	}

	@Test
	public void testRemoveGamme() {
		Gamme g1 = new Gamme("Sport");
		g1.addOption(new Option("Aileron"));
		g1.addOption(new Option("Autoradio"));
		g1.addOption(new Option("Jantes alu"));
		Gamme g2 = new Gamme("Promo");
		g2.addOption(new Option("Autoradio"));
		m.removeGamme(g1);
		assert (m.getGammes().size() == 1);
		assert !m.getGammes().contains(g1);
		assert m.getGammes().contains(g2);
	}
}
